@extends('backend.template.bootstrap')
@section('content')
<div id="page-wrapper" >
    <div id="page-inner">
        <div class="row">
            <div class="col-md-12">
                <h1 class="page-header">
                    分类管理 <small>Categories.</small>
                </h1>
                <ol class="breadcrumb">
                    <li><a href="#">首页</a></li>
                    <li><a href="{{ url('backend/categories') }}">分类</a></li>
                    <li class="active">@if(!$category->exists)添加分类@else {{ $category->name }} 编辑@endif</li>
                </ol>
            </div>
        </div>
        <!-- /. ROW  -->
        <div class="row">
            <div class="col-lg-12">
                <div class="panel panel-default">
                    <div class="panel-body">
						@if (Session::has('msg'))
			                <div class="alert alert-danger">
								<strong>错误!</strong>   
								{{ Session::get('msg') }}
							</div>
						@elseif ($errors->any())
			                <div class="alert alert-danger">
								<strong>错误!</strong> 
								{{ $errors->first() }}
							</div>
						@endif
                        <div class="row">
                            <div class="col-lg-10">
                                @if (!$category->exists)
                                    {!! Form::open(array('method' => 'POST', 'url' => 'backend/categories', 'role' => 'form')) !!}
                                @else
                                    {!! Form::model($category, array('method' => 'PATCH', 'url' => array('backend/categories', $category->id), 'role' => 'form')) !!}
                                @endif
                                <div class="form-group">
                                    {!! Form::label('order', '排序') !!}
                                    {!! Form::text('order', $category->order, array('class' => 'form-control', 'placeholder' => '请输入分类排序')) !!}
                                </div>
                                <div class="form-group">
                                    {!! Form::label('type', '分类类型') !!}
                                    {!! Form::select('type', \MyBlog\Models\Category::$TYPE_EX, $category->type, array('class' => 'form-control')) !!}
                                </div>
                                <div class="form-group">
                                    {!! Form::label('name', '分类名称') !!}
                                    {!! Form::text('name', $category->name, array('class' => 'form-control', 'placeholder' => '请输入分类名称')) !!}
                                </div>
                                <div class="form-group">
                                    {!! Form::label('content', '内容') !!}
                                    <div class="controls">
                                        <script id="content" name="content" type="text/plain">{!!  $category->content  !!}</script>
                                    </div>
                                </div>
                                <button type="submit" class="btn btn-primary"><i class="icon-ok"></i> 保存</button>
                                {!! Form::close() !!}
                            </div>
                        </div>
                        <!-- /.row (nested) -->
                    </div>
                    <!-- /.panel-body -->
                </div>
                <!-- /.panel -->
            </div>
        </div>
    </div>
    <!-- /. PAGE INNER  -->

</div>
@endsection